﻿//创建时间: 2010-10-15
//创建作者: 李晓忠
//功能说明: CMS系统 结点附加发布管理
//最后修改: 2010-10-15
//最后修改: 2010-10-18 添加发布名
using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using TRPOP.Common;
using TRPOP.CMS.Web.UI;


using TRPOP.CMS.Business;
using TRPOP.CMS.Model;

namespace TRPOP.CMS.Web.Admin
{
    public partial class NodeAddionalPub_list : BaseAdmin
    {
        #region 当前页面权限验证
        protected override void SubPageInit()
        {
            base.m_SubPagePermission = Plugin.PermissionKeys.PermissionEnum.Node_Save;
        }
        #endregion

        #region 页面变量
        protected string m_strTitle = "结点附加发布管理";
        protected int m_intNodeId = 0;
        NodeAddionalPubManage oNodeAddionalPubManage = new NodeAddionalPubManage();
        #endregion

        #region 页面事件
        protected void Page_Load(object sender, EventArgs e)
        {
            m_intNodeId = RequestHelper.RequestInt("nodeid", 0);
            if (m_intNodeId <= 0) { Alert("没有结点参数"); return; }
            if (m_intNodeId > 0)//验证用户对结点的权限
                base.AlertForNoPermission(base.CheckIsHavePermission(m_intNodeId));
            if (!IsPostBack)
            {
                LoadBase();
            }
        }
        protected void lbtnDelete_Click(object sender, EventArgs e)
        {
            LinkButton lbtn = (LinkButton)sender;
            int intId = 0;
            int.TryParse(lbtn.CommandArgument, out intId);
            NodeAddionalPubInfo info = oNodeAddionalPubManage.GetInfoById(intId);
            if (info != null)
            {   
               FileUtil.DeleteFile(oNodeAddionalPubManage.GetPubInfoPSNPath(info), true, "_");              
            }
            SubmitAlertDelete(oNodeAddionalPubManage.DeleteInfoById(intId));
            LoadBase();
        }    
        #endregion

        #region 页面方法
        public void LoadBase()
        {          
            rptList.DataSource = oNodeAddionalPubManage.GetListByCondition(0, " and NodeId=" + m_intNodeId, " NodeAddionalPubId asc");
            rptList.DataBind();
        }
        #endregion
    }
}
